#ifndef MESSAGE_HEADER_H
#define MESSAGE_HEADER_H

#include "../hostdep/stdint.h"
#include "message.h"

/**
 * The helper structure representing the message header. The alignment of the
 * fields does not correspond to the actual ordering in the packet buffer
 */
typedef struct {
    uint32_t message_id;
    uint16_t device_id;
    uint16_t message_number;
    message_type type;
    message_delivery delivery;
    message_scope scope;
    message_direction direction;
} message_header;

/**
 * Get the structure representation of the message header from the raw nessage
 * @param message the raw message from which the header is extracted
 * @param header the header structure to be filled
 */
void get_header(unsigned char* message, message_header* header);

#endif
